<extend name="common:commonTemplate" />

<block name="main_content">
<div class="accontft">
    <p class="accout_k2">可提现余额</p>
    <p class="account_num2"  style="color:#DC143C">{$promoter_en.withdraw_amount}</p>
</div>
<div class="withdrawalbox">
    <label for="">提现金额</label>
    <input id="txtAmount" type="text" placeholder="本次最多转出{$promoter_en.withdraw_amount}"/>
</div>

<a class="btn_01" href="javascript:void(0);" id="btn_submit">确认提现</a>
<a class="btn_01 active"  href="/promoter/withdrawDetail" id="btn_submit">提现明细</a>
<div class="account_txt">
    <p>提现规则：</p>
    <p>1. 财务每周四处理一周内的提现申请；</p>
    <p>2. 可在提现明细中追踪每笔提现状态；</p>
    <p>3. 目前仅支持支付宝提现，请确认注册时填写的账户无误。</p>
</div>
</block>

<block name="inner_script">
<script type="text/javascript">
$(document).ready(function(){
	$('#txtAmount').bind('keyup', function(){
		var amount = $('#txtAmount').val();
		if(amount == ""){
			$('#btn_submit').removeClass('active');
			return;
		}
		
		if(!isNaN(amount)){
			if(parseFloat(amount) <= 0)
			{
				$('#btn_submit').removeClass('active');
			}
			else{
				$('#btn_submit').addClass('active');	
			}
			
		}else{
			$('#btn_submit').removeClass('active');
		}
	});
	
	$('#btn_submit').bind('click', function(){
		if($('#btn_submit').hasClass('active')){
			var result = PromoterService.Withdraw($('body').attr('promoter_id'), $('#txtAmount').val());
			if(result.IsSuccess == 1){
				alert("提现申请成功");
				location.reload();
			}
			else{
				alert(result.ErrorMsg);
			}
		}
	});
});
</script>
</block>